//: Playground - noun: a place where people can play

import UIKit

//赋值运算符
    let a = 5;
    var b = 6
    b = a
    print(b)

//算术运算符  swift 不允许运算中出现溢出
    (4, "dog") == (4, "dog")//bool不能被比较

//空合运算符

    var aa: Int?
    aa = 3
    aa ?? b//等价于下一句
    aa != nil ? aa! : b

    let defaultColorName = "red"
    var userDefinedColorName: String?   //默认值为 nil
    var colorNameToUse = userDefinedColorName ?? defaultColorName
    userDefinedColorName = "green"
    colorNameToUse = userDefinedColorName ?? defaultColorName

//区间运算符
    //闭区间运算符 （a...b）从a到b之间所有值，包括ab
    for index in 1...5{
        print(index );
    }
    //半开区间运算符 a..<b
